gtk-demo: Add an "Unsorted" option (and default to it)
authorBenjamin Otte <otte@redhat.com>
Sun, 21 Jun 2020 04:54:21 +0000 (06:54 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 21 Jun 2020 12:17:47 +0000 (14:17 +0200)
Tests the previous commit and ensures that selecting 16M colors actually
works quickly (it does).

demos/gtk-demo/listview_colors.c

index 7441b3249ac19e44d479d6674b185aec42a0ffe9..9e6acab411106d4acd6c83b58b8c8c8d10137e44 100644 (file)
@@ -792,6 +792,14 @@ do_listview_colors (GtkWidget *do_widget)
 
       sorters = g_list_store_new (GTK_TYPE_SORTER);
 
+      /* An empty multisorter doesn't do any sorting and the sortmodel is
+       * smart enough to know that.
+       */
+      sorter = gtk_multi_sorter_new ();
+      set_title (sorter, "Unsorted");
+      g_list_store_append (sorters, sorter);
+      g_object_unref (sorter);
+
       sorter = gtk_string_sorter_new (gtk_property_expression_new (GTK_TYPE_COLOR, NULL, "name"));
       set_title (sorter, "Name");
       g_list_store_append (sorters, sorter);